Skip to content

chore: replace lint, format, and git hook tooling - #44

Open
yowainwright wants to merge 1 commit into
dev-toolchain/node-testsfrom
dev-toolchain/oxc-hooks
Open

yowainwright wants to merge 1 commit into
dev-toolchain/node-testsfrom
dev-toolchain/oxc-hooks

Conversation

@yowainwright

@yowainwright yowainwright commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes

  • This PR replaces eslint and prettier for oxlint and oxfmt.
  • It also replaces husky and commitlint with bash scripts.

Read about referenced issues here. Replace words with this Pull Request's context.

Replaces ESLint and Prettier with plain project Oxlint/Oxfmt configurations while keeping Chomp. Removes Husky and commitlint and replaces them with scripts/install-hooks.sh plus a small commit-message validator.

The installer generates executable hooks in Git's hooks directory, preserves existing hooks, skips CI, and does not change custom hooks paths. Removes obsolete Chomp tasks.

Validation: build, typecheck, lint, formatting, shell checks, 49 unit tests and 1 end-to-end test pass. Tests cover hook generation, dispatch, commit validation, preservation and CI behavior.
@yowainwright
yowainwright added this pull request to stack #46 November 7, 2026 02:27
@yowainwright yowainwright changed the title chore: replace lint, format, and Git hook tooling chore: replace lint, format, and git hook tooling Nov 7, 2026
@yowainwright
yowainwright marked this pull request as ready for review November 7, 2026 03:16

@guybedford guybedford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice follow-on, thanks! Moving to Oxlint / Oxfmt is a great simplification, the lockfile shrinks a lot, and the build + runtime matrix split in CI is a neat way to test the compiled output against production deps only. Good to see the dead chomp tasks cleaned up too.

Ran it locally on Node 26 - lint, format check, typecheck and all 49 unit + 1 e2e tests pass.

Just a few small things inline to keep parity with the previous hook setup.

if (!messagePath) throw new Error("Provide a commit-message file path.");

const header = readFileSync(messagePath, "utf8").split(/\r?\n/, 1)[0];
const format = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|breaking)(\([^)]+\))?!?: \S.*$/;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commitlint ignored a few message shapes by default that this regex now rejects - version commits from npm version (0.2.3, which we have in the history), Revert "...", and fixup! / squash!. Could we allow those through alongside the Merge case?

Comment thread scripts/install-hooks.sh
hooks_dir=$(git rev-parse --git-path hooks)
if has_custom_hooks_path; then
printf 'core.hooksPath is already configured; leaving it unchanged.\n' >&2
exit 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone who previously ran husky install will have core.hooksPath=.husky set locally, so will hit this exit until they run git config --unset core.hooksPath. Worth a one-line note in the readme for the migration.

Comment thread scripts/install-hooks.sh
#!/bin/sh
set -eu
main() {
PATH="$PWD/.bin:$PATH"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is .bin here? I don't see anything in the repo creating it (this looks related to the .gitignore entry in #43).

Comment thread scripts/install-hooks.sh
write_hook() {
hook_name=${1:?Missing hook name}
hook_path="$hooks_dir/$hook_name"
if hook_exists; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: since existing hooks are always kept, later changes to the hook bodies here won't reach anyone who has already installed. Committing the hooks to a hooks/ directory and pointing core.hooksPath at it would avoid that and the generator, but fine as-is too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants